<!-- #layout name=noMenu --sideType='domain'-->

<div id="app">
    <div class="page-header">
        <h1 class="title">SSL Certificate</h1>
    </div>
    <div class="navbar navbar-default">
        <div class="container-fluid">

            <a k-if="kooboosetting.IsLocal = false" class="btn green navbar-btn" @click.stop="showDialog">
                <span>Generate certificate</span> <i class="fa fa-plus"></i>
            </a>

            <a v-if="tableDataSelected.length > 0" @click.stop="onDelete" class="btn red navbar-btn">Delete</a>
        </div>
    </div>
    <kb-table
            :show-select="true"
            :data="tableData"
            :selected.sync="tableDataSelected"
    >
        <kb-table-column :label="Kooboo.text.common.name">
            <template v-slot="row">
                {{row.domainName}}
            </template>
        </kb-table-column>
        <kb-table-column :label="Kooboo.text.site.domain.expires">
            <template v-slot="row">
                <span class="label label-sm green">{{row.expires}}</span>
            </template>
        </kb-table-column>
    </kb-table>

    <div
            class="modal fade"
            data-backdrop="static"
            data-keyboard="false"
            v-kb-modal="modalShow"
    >
        <div class="modal-dialog" v-if="modalShow">
            <div class="modal-content">
                <div class="modal-header">
                    <button @click="cancelDialog" type="button" class="close">
                        <i class="fa fa-close"></i>
                    </button>
                    <h4 class="modal-title">Select a domain</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="DomainName">Domain</label>
                            <div class="col-md-10">
                                <div class="form-inline">
                                    <input type="text" v-model="subDomain" class="form-control input-small" >
                                    <select v-model="selectedDomain" class="form-control input-small">
                                        <option v-for="item in domainList" :value="item.name">{{item.name}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button @click.stop="save" class="btn green">Generate</button>
                    <button @click.stop="cancelDialog" class="btn gray">Cancel</button>
                </div>
            </div>
        </div>
    </div>

</div>


<script>
    (function() {
        Kooboo.loadJS([
            "/_Admin/Scripts/components/kbTable.js"
        ])
    })()
</script>
<script src="/_Admin/View/Domains/Certificate.js"></script>
